<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:t="http://myfaces.apache.org/tomahawk">

<ui:composition template="layout/layout.xhtml">
	<ui:define name="content">
		<f:view locale="#{LocalizationController.locale}">
			<a4j:form ajaxSubmit="true"
				reRender="myTestPlanList,systemTestPlanList,scrollValidationDown,scrollValidationDown2,scroll_1_div,scroll_2_div">

				<h3>Test Plan Manager</h3>
				<h4><h:outputText value="#{msgs.TestPlan1MyTP}" /></h4>
				
				<a4j:outputPanel styleClass="formErrorMessage" ajaxRendered="true">
					<h:outputText id="formMessage" value="#{MyTestPlanManagerController.testPlanFormMessage}" rendered="#{MyTestPlanManagerController.showTestPlanFormMessage}" />
				</a4j:outputPanel>
				
				<t:dataTable id="myTestPlanList" var="testPlan" styleClass="table table-striped"
					value="#{MyTestPlanManagerController.userTestPlanList}" preserveDataModel="false"  style="margin-top: 20px;">

					<h:column>
						<f:facet name="header">
							<h:outputText value="#{msgs.TestPlan3Name}" />
						</f:facet>
						<h:outputText value="#{testPlan.name}" />
					</h:column>

					<h:column>
						<f:facet name="header">
							<h:outputText value="#{msgs.TestPlan4Description}" />
						</f:facet>
						<h:outputText value="#{TestPlanManagerController.tempDescription}" />
					</h:column>
					
					<t:column styleClass="tdVerticalAligned">
						<f:facet name="header">
							<h:outputText styleClass="headerText" value="#{msgs.TestPlan9Action}" />
						</f:facet>
						<a4j:commandLink id="createSessionlink" style="margin-left: 10px;"
							action="#{MyTestPlanManagerController.openCreateSessionViewFromTestPlan}"> 
							<i class="icon-play-circle icon-2x"></i>
							<a4j:actionparam name="selectedTestPlanName" value="#{testPlan.id}"
								assignTo="#{SessionManagerController.selectedTestPlan}" />
						</a4j:commandLink>
						<rich:toolTip for="createSessionlink" value="#{msgs.TestPlan10CreateSession}" />
					</t:column>
					
					<h:column>
						<f:facet name="header">
							<h:outputText value="#{msgs.TestPlan5CreationDate}" />
						</f:facet>
						<h:outputText value="#{testPlan.creationDatetime}" />
					</h:column>

					<h:column>
						<f:facet name="header">
							<h:outputText value="#{msgs.TestPlan6LastUpdateDate}" />
						</f:facet>
						<h:outputText value="#{testPlan.lastUpdateDatetime}" />
					</h:column>

					<h:column>
						<f:facet name="header">
							<h:outputText value="#{msgs.TestPlan7State}" />
						</f:facet>
						<h:outputText value="#{testPlan.state}" />
					</h:column>

					<h:column>
						<f:facet name="header">
							<h:outputText value="#{msgs.TestPlan8Location}" />
						</f:facet>
						<a href="#{testPlan.publication}" target="_blank"><h:outputText value="#{msgs.TestPlan82xml}" /></a>
					</h:column>
					
					<h:column>
						<f:facet name="header">
							<h:outputText value="#{msgs.Common12Delete}" />
						</f:facet>
						<a4j:commandLink ajaxSingle="true" id="trashlink3" oncomplete="#{rich:component('deletePanel')}.show()">
							<i class="icon-trash icon-2x"></i>
							<a4j:actionparam name="idTestPlanToDelete" value="#{testPlan.id}" assignTo="#{MyTestPlanManagerController.testPlanToDelete}" />
						</a4j:commandLink>
						<rich:toolTip for="trashlink3" value="#{msgs.Common2Cancel}" />
					</h:column>				

				</t:dataTable>
				
				<h4><h:outputText value="#{msgs.TestPlan2SysTP}" /></h4>
				
				<t:dataTable id="systemTestPlanList" var="testPlan" styleClass="table table-striped"
					value="#{TestPlanManagerController.systemTestPlans}"  style="margin-top: 20px;">

					<h:column>
						<f:facet name="header">
							<h:outputText value="#{msgs.TestPlan3Name}" />
						</f:facet>
						<h:outputText value="#{testPlan.name}" />
					</h:column>
					<h:column>
						<f:facet name="header">
							<h:outputText value="#{msgs.TestPlan4Description}" />
						</f:facet>
						<h:outputText value="Description TODO" />
					</h:column>
					
					<t:column styleClass="tdVerticalAligned">
						<f:facet name="header">
							<h:outputText styleClass="headerText" value="#{msgs.TestPlan9Action}" />
						</f:facet>
						<a4j:commandLink id="importlink"
							action="#{MyTestPlanManagerController.importTestPlan}">
							<i class="icon-upload icon-2x"></i>
							<a4j:actionparam name="selectedItem" value="#{testPlan.id}"
								assignTo="#{MyTestPlanManagerController.selectedTestPlanId}" />
						</a4j:commandLink>
						<rich:toolTip for="importlink" value="#{msgs.Common3Import}" />
					</t:column>
					
					<h:column>
						<f:facet name="header">
							<h:outputText value="#{msgs.TestPlan5CreationDate}" />
						</f:facet>
						<h:outputText value="#{testPlan.creationDatetime}" />
					</h:column>

					<h:column>
						<f:facet name="header">
							<h:outputText value="#{msgs.TestPlan6LastUpdateDate}" />
						</f:facet>
						<h:outputText value="#{testPlan.lastUpdateDatetime}" />
					</h:column>

					<h:column>
						<f:facet name="header">
							<h:outputText value="#{msgs.TestPlan7State}" />
						</f:facet>
						<h:outputText value="#{testPlan.state}" />
					</h:column>

					<h:column>
						<f:facet name="header">
							<h:outputText value="#{msgs.TestPlan8Location}" />
						</f:facet>
						<a href="#{testPlan.publication}" target="_blank"><h:outputText value="#{msgs.TestPlan82xml}" /></a>
					</h:column>

				</t:dataTable>

				<rich:modalPanel id="deletePanel" autosized="true" width="250">
					<f:facet name="header">
						<h:outputText value="#{msgs.TestPlan11DeleteQuestion}" />
					</f:facet>
					<br />
					<table width="100%">
						<tbody>
							<tr>
								<td align="center" width="20%">
									<i class="icon-warning-sign icon-3x red"></i>
								</td>
								<td align="center" width="40%">
									<a4j:commandLink value="#{msgs.Common12Delete}" styleClass="inputBtn inputBtn-blue"
										oncomplete="#{rich:component('deletePanel')}.hide();return true;"
										action="#{MyTestPlanManagerController.deleteTestPlan}" />
								</td>
								<td align="center" width="40%">
									<a4j:commandLink
										value="#{msgs.Common2Cancel}" styleClass="inputBtn inputBtn-grey"
										onclick="#{rich:component('deletePanel')}.hide();return false;" />
								</td>
							</tr>
						</tbody>
					</table>
				</rich:modalPanel>
								
			</a4j:form>
		</f:view>
	</ui:define>
</ui:composition>
</html>